package com.yunji.generate.bean;

import java.io.Serializable;
import java.util.*;

/**
 * Bean
 **/
public class BeanInfo implements Serializable {

    private boolean isLombokSupported;
    private boolean isExcelSupported;
    private boolean isSwaggerSupported;

    private String packageName;
    private String author;

    private String name;
    private String tableName;
    private String remarks;

    private List<FieldInfo> fields;

    /**
     * 获取所有字段类型包路径（freemaker）
     */
    public List<String> getFieldClassNames() {
        if (fields == null) {
            return Collections.emptyList();
        }
        Set<String> set = new TreeSet<>();
        for (FieldInfo field : fields) {
            set.add(field.getClassName());
        }
        return new ArrayList<>(set);
    }

    public boolean isSwaggerSupported() {
        return isSwaggerSupported;
    }

    public void setSwaggerSupported(boolean swaggerSupported) {
        isSwaggerSupported = swaggerSupported;
    }

    public boolean isLombokSupported() {
        return isLombokSupported;
    }

    public void setLombokSupported(boolean lombokSupported) {
        isLombokSupported = lombokSupported;
    }

    public boolean isExcelSupported() {
        return isExcelSupported;
    }

    public void setExcelSupported(boolean excelSupported) {
        isExcelSupported = excelSupported;
    }

    public String getPackageName() {
        return packageName;
    }

    public void setPackageName(String packageName) {
        this.packageName = packageName;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getTableName() {
        return tableName;
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    public String getRemarks() {
        return remarks;
    }

    public void setRemarks(String remarks) {
        this.remarks = remarks;
    }

    public List<FieldInfo> getFields() {
        return fields;
    }

    public void setFields(List<FieldInfo> fields) {
        this.fields = fields;
    }
}
